
package GUI;

import java.io.*;
import java.util.Vector;
import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.JFrame;
import java.awt.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import jess.*;
/**
 *
 * @author  Tony
 * @param <Batch>
 */
public class FramePreguntaJuridico extends javax.swing.JFrame {

    /** Creates new form FramePreguntaTecnico1 */
    private JFrame framePadre;
    private Vector vector;
    BufferedWriter writer;
    BufferedReader reader;
    Rete engine;
    Batch batch;

    public FramePreguntaJuridico(JFrame fr) throws FileNotFoundException {
    	engine = new Rete ();
    	batch = new Batch();
        this.setVisible(true);
        this.framePadre=fr;
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jComboBox1 = new javax.swing.JComboBox();
        jButtonVolver = new javax.swing.JButton();
        jButtonAsesorar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel1.setText("Asesoramiento Jurídico");

        jLabel2.setText("¿Esta pensando en presentarse a una oferta de empleo público?");

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Sí", "No" }));

        jButtonVolver.setText("Volver");
        jButtonVolver.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonVolverActionPerformed(evt);
            }
        });

        jButtonAsesorar.setText("Asesorar");
        jButtonAsesorar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAsesorarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(121, 121, 121)
                .addComponent(jButtonVolver)
                .addGap(43, 43, 43)
                .addComponent(jButtonAsesorar)
                .addContainerGap(98, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(46, Short.MAX_VALUE)
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 344, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(154, 154, 154)
                .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(156, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(117, 117, 117)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(125, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addComponent(jLabel1)
                .addGap(28, 28, 28)
                .addComponent(jLabel2)
                .addGap(28, 28, 28)
                .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(60, 60, 60)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonAsesorar)
                    .addComponent(jButtonVolver))
                .addContainerGap(75, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jButtonVolverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonVolverActionPerformed
this.setVisible(false);     
    this.framePadre.setVisible(true);
}//GEN-LAST:event_jButtonVolverActionPerformed

private void jButtonAsesorarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAsesorarActionPerformed
int indice =jComboBox1.getSelectedIndex();
    switch ( indice ) {
      case 0:
                
        this.setVisible(false);
        try {
            engine.assertString("(oposiciones si)");
            JFrame fram = new FramePreguntaJuridicoSI(this,engine,batch);

        } catch (Exception ex) {
            Logger.getLogger(FramePreguntasTecnico.class.getName()).log(Level.SEVERE, null, ex);
        }
           break;
      case 1:
        this.setVisible(false);
        try {
            engine.assertString("(oposiciones no)");
            JFrame fram = new FramePreguntaJuridicoNO(this,engine,batch);
        } catch (Exception ex) {
            Logger.getLogger(FramePreguntasTecnico.class.getName()).log(Level.SEVERE, null, ex);
        }
       
           break;
     
      default:
           System.out.println("error" );
           break;
      }
}//GEN-LAST:event_jButtonAsesorarActionPerformed

    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonAsesorar;
    private javax.swing.JButton jButtonVolver;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    // End of variables declaration//GEN-END:variables

}
